package com.smarthome.common.tools;

import java.security.MessageDigest;

public class SHACipher {

    private static final String KEY_SHA = "SHA";

    public static String encrypt(String data) throws Exception {
        byte[] bytes = data.getBytes("UTF-8");
        MessageDigest sha = MessageDigest.getInstance(KEY_SHA);
        sha.update(bytes);

        return HexUtils.encodeHexStr(sha.digest());
    }

    public static void main(String[] args) throws Exception {
        System.out.println(encrypt("ssss"));
    }
}
